#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>

#define FILE_NAME "myfile"
#define FILE_OUT  "file_out"
int main()
{
    int in, out;
    char c;
    umask(277);
    in  = open(FILE_NAME, O_RDONLY);
    printf("%d\n", in);
    out = open(FILE_OUT, O_CREAT|O_WRONLY, S_IRUSR|S_IWUSR);
    printf("%d\n", out);
    while(read(in, &c, 1) == 1)
    {
        write(out, &c, 1);
        printf("%c", c);
    }
    return 0;
}
